Repository navigation
Fix geoticks for shifted rectangular projections - #829
Merged
Merged
Conversation
cvanelteren
marked this pull request as draft
September 28, 2026 11:24
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
cvanelteren
marked this pull request as ready for review
September 28, 2026 13:21
cvanelteren
force-pushed
the
fix/geoticks-lon0-828
branch
from
September 28, 2026 13:25
73eb8fe to
42c1e0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #828.
Cartopy gridliner tick locations are longitude/latitude coordinates, but UltraPlot was assigning them directly to the native Matplotlib x/y axes. That only works when the projection coordinates happen to match geographic coordinates (for example PlateCarree centered at 0°). With a shifted central longitude such as
lon0=180, native ticks can be displaced and can expand the axes enough to trigger the pixel-overflow error.This change explicitly transforms Cartopy geotick locations from PlateCarree into the target projection coordinates, then filters them to the current native x/y limits before installing them with a
FixedLocatoron the Matplotlib axes. Filtering is important for projections such as Mercator: locator padding can produce near-polar latitude ticks whose projected y values are enormous even though they lie outside the visible map. Passing those ticks throughset_ticks()would expand the view limits by design and contaminate the layout bounds; using aFixedLocatoravoids that side effect.Basemap keeps the existing native-axis path.
Regression coverage checks the rectangular Cartopy projections supported by UltraPlot (
cyl,merc,lcyl, andmill) for several tick lengths, both global and zoomed extents, and verifies longitude/latitude tick coordinates and successful rendering. It also checks representative non-rectilinear projections (robin,moll, andortho) to ensure their existing behavior is unchanged:ticklenremains unsupported, emits the existing warning, does not modify native tick locations, and still renders successfully.